<?php

class IndexController extends Zend_Controller_Action
{
	public function indexAction()
	{
            /*$this->_helper->layout->disableLayout();
            $this->_helper->viewRenderer->setNoRender();*/

            $select = new Application_Model_ActivityModel();
            
            $actividades = $select->fetchAll("start_date <= now()");

            
            $taskPendientes = array();
            
            foreach($actividades->toArray() as $actividad){
                $idAct = $actividad["idactivities"];
                $selectTask = new Application_Model_TaskModel();
                $tasks = $selectTask->fetchAll("idactivities = ".$idAct)->toArray();
                foreach($tasks as $task){
                    $taskPendientes[] = array(
                                        "id" => $task["idtasks"],
                                        "nombre" => $task["nombre"]
                                        );
                }
            }

            $this->view->taskPendientes = $taskPendientes;

	}
}